package com.milo.common.enums;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: gscc_card_selling
 * @description: 异网短信发送响应枚举类
 * @author: Milogenius
 * @create: 2018-06-05 16:09
 **/
public enum SmsEnum {


    /**成功*/
    SUCCESS("0","成功"),
    /**失败*/
    FAIL("1","失败"),
    /**APPKEY错误*/
    APPKEY_ERROR("10001","APPKEY错误"),
    /**参数缺失*/
    DEFICIENCY_PARAM("10002","参数缺失"),
    /**签名验证失败*/
    SIGN_VAL_ERROR("10003","签名未传或验证失败"),
    /**接口异常*/
    INTERFACE_SERVICE_ERROR("10004","接口异常"),
    /**传入的参数为空或null*/
    PARAM_NULL("10005","参数为空或null");

    private String status;
    private String desc;

    SmsEnum(String status, String desc){
        this.status = status;
        this.desc = desc;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static Map<Integer, SmsEnum> codeLookup = new HashMap<Integer, SmsEnum>();


    public static SmsEnum forCode(int code) {
        if(codeLookup.get(code) != null){
            return codeLookup.get(code);
        }
        return SmsEnum.INTERFACE_SERVICE_ERROR;
    }
    public static void main(String[] args) {
        System.out.println(SmsEnum.SUCCESS.getStatus());
        System.out.println(SmsEnum.SUCCESS.getDesc());
    }
}
